<?php

	error_reporting(E_ALL ^ E_NOTICE);
	session_start();

	$mysql_host = "127.0.0.1";
	$mysql_user = "root";
	$mysql_pass = "d1g1taljuice";
	$mysql_dbnm = "hotel";
	$mysql_conn = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
	if(!$mysql_conn) die("<centre>Error connecting to database</centre>");
				  mysql_select_db($mysql_dbnm, $mysql_conn);
	
	$name = "Exeyous!";
	$siteurl = "http://exeyo.us";
	$host = "64.31.36.170";
	$port = 30000;
	$external_vars = "http://212.38.176.149/r63/gamedata/external_variables.txt";
	$external_txts = "http://212.38.176.149/r63/gamedata/external_flash_texts.txt";
	$external_frni = "http://212.38.176.149/r63/gamedata/furnidata.txt";
	$external_prdt = "http://212.38.176.149/r63/gamedata/productdata.txt";
	$external_dcrs = "http://212.38.176.149/r63/gordon/RELEASE63-34096-33779-201105271559/";
	
	function set_token($username) {
		$token = md5(sha1(sha1($username + rand(0, strlen($username)))));
		mysql_query("UPDATE users SET auth_ticket='" . $token . "' WHERE username='" . $username . "'");
		return $token;
	}

	function error_redirect($error, $register = false) {
		if($register) echo '<meta http-equiv="refresh" content="0;url=index.php?register=true&err=' . $error . '"/>';
		else echo '<meta http-equiv="refresh" content="0;url=index.php?err=' . $error . '"/>';
		die();
	}
	
	function valid($type, $string) {
		if($type=="password") return !preg_match('/[^A-Za-z0-9]/', $str);
		if($type=="username") return !preg_match('/[^A-Za-z0-9.#\\-$]/', $str);
		return false;
	}
	
?>